package com.olinsports.system.olinsportssystem.controller;

import com.olinsports.system.olinsportssystem.manager.InventorySettingsManager;
import com.olinsports.system.olinsportssystem.manager.SavingDetailManager;
import com.olinsports.system.olinsportssystem.model.InventorySettings;
import com.olinsports.system.olinsportssystem.model.SavingDetail;
import com.olinsports.system.olinsportssystem.service.SavingDetailService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/22.
 */
@Controller
@RequestMapping("savingDetail")
public class SavingDetailController {
    @Autowired
    private SavingDetailManager savingDetailManager;

    @RequestMapping("/selectBySaveKey")
    @ResponseBody
    public SavingDetail selectBySaveKey(int saveKey){
        return savingDetailManager.selectBySaveKey(saveKey);
    }

    @RequestMapping("/listSavingDetail")
    @ResponseBody
    public Map listSavingDetail(String page, String rows,String sord, String sidx){
        return savingDetailManager.listSavingDetail(page,rows,sord,sidx);
    }

    @RequestMapping("/searchDate")
    @ResponseBody
    public Map searchDate(String page, String rows,String startDate,String endDate){
        return savingDetailManager.searchDate(page,rows,startDate,endDate);
    }

    @RequestMapping("/toDcExcel")
    @ResponseBody
    public ModelAndView toDcExcel(String startDate, String endDate, HSSFWorkbook workbook) throws Exception{
        return savingDetailManager.toDcExcel(startDate,endDate,workbook);
    }

    @RequestMapping("/searchSelf")
    @ResponseBody
    public Map searchSelf(String page, String rows,String field,String fieldValue){
        return savingDetailManager.searchSelf(page,rows,field,fieldValue);
    }

    @RequestMapping("/getSumTotal")
    @ResponseBody
    public int getSumTotal(){
        return savingDetailManager.getSumTotal();
    }
}
